<?php

# Inclusion des  classes de gestion
include_once "class/app/objectList.class.php";
include_once "class/app/categorieList.class.php";
include_once "class/app/cityList.class.php";
include_once "class/app/personList.class.php";

$mySession = Session::getInstance();
$laPersonne = $mySession->getPersonne();


$objectList = new ObjectList();
$categorie = new CategorieList();
$cityList = new CityList();
$personList = new PersonList();
if($mySession->getConnect()) {
	$lesObjets = $objectList->getObjetsOtherPerson($laPersonne->getIdPerson());
} else {
	$lesObjets = $objectList->getObjets(true);
}

foreach($lesObjets as $i => $unObjet){

	$_TPL['Objets'][$i]["idObject"]            = $unObjet->getIdObject();			
	$_TPL['Objets'][$i]["labelObject"]         = $unObjet->getLabelObject();
	$_TPL['Objets'][$i]["picsObject"]          = $unObjet->getPicsObject();
	$_TPL['Objets'][$i]["dateObject"]          = fDate($unObjet->getDateObject());
	$_TPL['Objets'][$i]["StateObject"]         = $unObjet->getStateObject();
	$_TPL['Objets'][$i]["StatusObject"]        = $unObjet->getStatusObject();
	$_TPL['Objets'][$i]["idPerson"]            = $unObjet->getIdPerson();
	
	$uneCategorie = $categorie->getCategorie($unObjet->getIdCategorie());
	
	$_TPL['Objets'][$i]["idCategorie"]          = $uneCategorie->getIdCategorie();
	$_TPL['Objets'][$i]["labelCategorie"]       = $uneCategorie->getLabelCategorie();
	$_TPL['Objets'][$i]["descriptionCategorie"] = $uneCategorie->getDescriptionCategorie();
	
	$unePersonne = $personList->getPersonne($unObjet->getIdPerson());
	$_TPL['Objets'][$i]["idPerson"] 			= $unePersonne->getIdPerson();
	$_TPL['Objets'][$i]["nomPerson"] 			= $unePersonne->getNomPerson();
	$_TPL['Objets'][$i]["pernomPerson"] 		= $unePersonne->getPrenomPerson();
	
	$uneCity = $cityList->getCity($unePersonne->getIdCity());
	$_TPL['Objets'][$i]["idCity"] 			    = $uneCity->getIdCity();
	$_TPL['Objets'][$i]["labelCity"] 			= $uneCity->getLabelCity();
	$_TPL['Objets'][$i]["cpCity"] 		        = $uneCity->getCpCity();
	$_TPL['Objets'][$i]["idDepartement"] 	    = $uneCity->getIdDepartement();
	$_TPL['Objets'][$i]["codeDepartement"] 		= $uneCity->getCodeDepartement();
	$_TPL['Objets'][$i]["labelDepartement"] 	= $uneCity->getLabelDepartement();
}



# Inclusion du Template
include_once "templates/modules/autres/accueil/accueil.tpl.php";

?>